<template>
  <van-search
    :style="{ width: width + 'px', height: height + 'px' }"
    v-model="value"
    class="search"
    readonly
    input-align="center"
    @click="gotoSearch"
  />
</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  name: 'VIpt'
})
</script>

<script setup lang="ts">
import { ref, defineProps } from 'vue'
import { useRouter } from 'vue-router'

const value = ref('搜索商品，共144652款好物')

const props = defineProps({
  width: {
    type: Number,
    require: true,
    default: 345
  },
  height: {
    type: Number,
    require: true,
    default: 28
  }
})

const router = useRouter()

// 跳转到搜索页面
const gotoSearch = (): void => {
  router.push({
    path: '/search'
  })
}
</script>

<style lang="less">
html,
body {
  height: 100%;
}
</style>

<style scoped lang="less">
.search {
  padding: 0;
  margin: 0 auto;
}
</style>
